﻿<Window x:Class="CPPEI.Coolzon.UI.XProperty.Editors.ColorPlateEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.UI.XProperty.Editors"
        mc:Ignorable="d"
        Title="调色板" Height="585" Width="290" MinWidth="290" Topmost="True" ShowInTaskbar="False" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" Style="{DynamicResource WindowStyle}" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="32"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}" Grid.Row="0" Orientation="Horizontal">
            <Button Name="_ctlAdd" Style="{DynamicResource AddButtonStyle}" MinWidth="36" FontSize="15" VerticalContentAlignment="Center"  Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
            <Button Name="_ctlRemove" Style="{DynamicResource RemoveButtonStyle}"  FontSize="15" MinWidth="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
            <Button Name="_ctlUp" Style="{DynamicResource UpButtonStyle}" FontSize="15" MinWidth="36" Margin="3" ToolTip="上移" Click="_ctlUp_Click"/>
            <Button Name="_ctlDown" Style="{DynamicResource DownButtonStyle}" FontSize="15" MinWidth="36" Margin="3" ToolTip="下移" Click="_ctlDown_Click"/>
        </StackPanel>
        <DataGrid Grid.Row="1" x:Name="_ctlColorPlate" Margin="5" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False"  AutoGenerateColumns="False" SelectionMode="Single"  >
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="序列" Width="40" SortDirection="Ascending">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Margin="4" VerticalAlignment="Center" Text="{Binding Path=Index}"></TextBlock>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="颜色" MinWidth="100" Width="140">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Margin="2" Height="16" VerticalAlignment="Center" Text="{Binding Path=ColorString}"></TextBlock>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                    <DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <TextBox Height="20" Text="{Binding Path=ColorString, Mode=TwoWay}"  ></TextBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellEditingTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="" Width="*">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Border Background="{Binding Path=ColorBrush}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <Grid Grid.Row="2">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" Width="75" />
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click" Width="75"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
